package cn.maihe.elg.operation.model.enums;

import java.util.Arrays;

/**
 * @Description
 * @Author Alan
 * @Date 2024/09/12
 */
public enum CertifyCodeEnum {

    HYMMZ("C0010MZ", "闽中平台"),
    HYMHYZ("C0010HYZ", "海易招(福州)平台"),
    NingDe001("NingDe001","宁德"),
    YanCheng001("YanCheng001","盐城"),
    HuangShi001("HuangShi001","黄石"),

    XM001("XM001","厦门测试平台"),
    ;

    /**
     * 产品代码
     */
    private String certifyCode;
    /**
     * 产品名称
     */
    private String certifyName;

    CertifyCodeEnum(String certifyCode, String certifyName) {
        this.certifyCode = certifyCode;
        this.certifyName = certifyName;
    }

    public String getCenterNo() {
        return certifyCode;
    }

    public String getCenterName() {
        return certifyName;
    }

    public static CertifyCodeEnum resolve(String certifyCode) {
        return Arrays.stream(values()).filter(o -> o.getCenterNo().equals(certifyCode)).findFirst().orElseThrow(() -> new RuntimeException("查无此产品代码[" + certifyCode + "]记录"));
    }


    @Override
    public String toString() {
        return String.format("%s:%s", certifyCode, certifyName);
    }
}
